<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>会议室使用信息</title>
<link rel="stylesheet" type="text/css"
	href="../bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css"
	href="../bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="../easyui/jquery.min.js"></script>
<style type="text/css">
th {
	font-size: 18px;
}
td {
	font: 16px 微软雅黑;
}
</style>
</head>
<body>
<div class="table-responsive">
	<table class="table table-striped" style="width: 98%;" align="center">
		<caption
			style="font-weight: bold; font-size: 24px; text-align: center;">会议室使用情况</caption>
		<colgroup>
			<col style="width: 120px;" />
			<col style="width: 80px;" />
			<col style="width: 170px;" />
			<col style="width: 170px;" />
			<col style="width: 170px;" />
			<col />
		</colgroup>
		<thead>
			<tr>
				<th>会议室</th>
				<th>申请人</th>
				<th>开始时间</th>
				<th>结束时间</th>
				<th>联系电话</th>
				<th style="max-width: 40%;">用途</th>
				<!-- 
				<th data-options="field:'roomName',width:80">申请人</th>
				<th data-options="field:'createUserName',width:80">申请人</th>
				<th data-options="field:'start_date',width:100"
					formatter="fyDateFormatter">开始时间</th>
				<th data-options="field:'end_date',width:100"
					formatter="fyDateFormatter">结束时间</th>
				<th data-options="field:'tel',width:80,align:'left'">联系电话</th>
				<th data-options="field:'text_hid',width:80,align:'left'">用途</th>
			 -->
			</tr>
		</thead>
		<tbody></tbody>
	</table>
	</div>
	<script language="javascript">
		function fyDateFormatter(value) {
			return value.substr(0, 16);
		}
		/**
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if (r != null)
				return decodeURI(r[2]);
			return null;
		}*/
		var roomMap = {
				"r_6678923448287972157":"2#会议室",
				"r_-1892067632754700950":"105",
				"r_4056408210128259530":"201",
				"r_-5759079016905097104":"308外面",
				"r_-8148793372322740713":"第一会议室",
				"r_8350031376533701392":"夹层厂会议室",
				"r_3079041627515735135":"2号会议室",
				"r_-2733983149237255168":"3号会议室",
				"r_-142520857015925938":"多功能厅",
				"r_-1484216196601789527":"第四会议室（二楼，MES办公室）",
				"r_6154842108520123801":"第三会议室",
				"r_714644834672724326":"308",
				"r_1128821599104224780":"307-1",
				"r_5405290441416328220":"一号会议室",
				"r_-8696228729482950959":"第一会议室",
				"r_-5655615034787412846":"三号会议室",
				"r_5610803405193956939":"培训室1",
				"r_-8742727752239660843":"电教室",
				"r_-724620365385678470":"二楼会议室",
				"r_-5500184898670213603":"1号：视频会议室",
				"r_6084582150265327109":"2号",
				"r_-7409308603328213181":"视频会议室",
				"r_-5309322695080001123":"第一会议室（三楼-内间）",
				"r_-1823095116536526561":"第三会议室（二楼）",
				"r_-6298798936841565952":"第七会议室（一楼总经理会议室）",
				"r_-1488650934391648368":"第一会议室",
				"r_441952111974236266":"202",
				"r_2273667311272348924":"会议室",
				"r_3754296022966945941":"电教室",
				"r_1014968952341086578":"三楼会议室",
				"r_-5748297550846801676":"四楼大教室",
				"r_-5394708588602307940":"101电教室",
				"r_-3013607855958112485":"102",
				"r_-3578333026011099655":"202",
				"r_8224733089084690330":"测试",
				"r_-6562922249600613413":"一楼会议室",
				"r_-2592171637529228689":"测试",
				"r_8160063478968896526":"4号会议室",
				"r_6202742695847283297":"多功能厅",
				"r_-75768763354625679":"第六会议室（一楼电教室）",
				"r_-4882298092935691139":"101室",
				"r_-306939159948017066":"308室",
				"r_-6029455842040787683":"培训室",
				"r_706040197476339446":"第三会议室",
				"r_7634426179249785506":"培训室",
				"r_-3439580807811937640":"二楼会议室",
				"r_-5622094988466892953":"308",
				"r_-5533734683790917030":"8号",
				"r_1008465055610913077":"第二会议室（三楼-外间）",
				"r_717559887434432893":"第六会议室（一楼电教室）",
				"r_-7946698729308467678":"第七会议室（一楼总经理会议室）",
				"r_1373366930108991101":"第三会议室",
				"r_-594782963221443494":"202室",
				"r_-3007696176569168934":"307室",
				"r_-6446506952040232121":"308外面",
				"r_-5935922308876385801":"第二会议室",
				"r_3464345871500987548":"第四会议室",
				"r_-7252832697309115480":"二号会议室",
				"r_6244558137473126314":"四楼会议室（1）",
				"r_3010351197382134271":"三楼会议室",
				"r_4480719858897667794":"一楼培训教室",
				"r_-1775649256077573343":"钢化厂会议室",
				"r_3698838437762187435":"第五会议室（三楼，MES办公室）",
				"r_1936991316521470626":"第二会议室",
				"r_-530225912282528643":"307-2"
		};

		function startTime() {
			$(".table").find("tbody").empty();
			var roomdata;
			$
					.getJSON(
							"../../zc_mrc.do?method=mtroomAjax",
							function(json) {
								for (var i = 0; i < json.length; i++) {
									json[i].roomName = roomMap["r_"
											+ json[i].section_id]
								}
								for (var i = 0; i < json.length; i++) {
									for (var j = i + 1; j < json.length; j++) {
										if (json[i].roomName
												.localeCompare(json[j].roomName) > 0) {
											roomdata = json[i];
											json[i] = json[j];
											json[j] = roomdata;
										} else if (json[i].roomName == json[j].roomName
												&& json[i]["start_date"]
														.localeCompare(json[j]["start_date"]) > 0) {
											roomdata = json[i];
											json[i] = json[j];
											json[j] = roomdata;
										}
									}
								}
								roomdata = [];
								for (var i = 0; i < json.length; i++) {
									roomdata.push("<tr>");
									roomdata.push("<td>");
									roomdata.push(json[i]["roomName"]);
									roomdata.push("</td>");
									roomdata.push("<td>");
									roomdata.push(json[i]["createUserName"]);
									roomdata.push("</td>");
									roomdata.push("<td>");
									roomdata.push(json[i]["start_date"].substr(
											0, 16));
									roomdata.push("</td>");
									roomdata.push("<td>");
									roomdata.push(json[i]["end_date"].substr(0,
											16));
									roomdata.push("</td>");
									roomdata.push("<td>");
									roomdata.push(json[i]["tel"]);
									roomdata.push("</td>");
									roomdata.push("<td>");
									roomdata.push(json[i]["text_hid"]);
									roomdata.push("</td>");
									roomdata.push("</tr>");
								}
								$(".table").find("tbody").append(
										roomdata.join(""));
								setTimeout('startTime()', 30000);
							});
		}
		//var roomName;

		$(function() {
			//roomName = getQueryString("roomName");
			//$(".m-title").text(roomName);
			startTime();
		});
	</script>
</body>

</html>